﻿#include<iostream>
class T {
	int GetMp()const { return mp; }
	void SetMp(int _mp) { mp = _mp; }
public:
	int hp;

	T() {//构造函数，任何一个类至少有一个构造函数
		hp = 100;
		mp = 800;
	}

	explicit T(int _hp) {//explicit关键字用于禁止类型转换
		hp = _hp;
	}

	T(int _hp, int _mp) {
		hp = _hp;
		mp = _mp;
	}
	T(T& t) {
		hp = t.hp;
		mp = t.mp;
	}

	bool IsBig(T r) {//对于user.IsBig(300)，执行过程为300初始化r，使用构造函数T(int _hp)，然后再比较
		return r.hp > hp;
	}

private:
	int mp;
};
int main() {
	T t2;
	t2.hp = 1997;
	t2.SetMp(1999);
	T t1{ t2 };

	T t1(100, 200);
	std::cout << t1.hp << " " << t1.GetMp() << std::endl;

	T role;
	T user;
	user.hp = 100;
	role.hp = 200;

	std::cout << user.IsBig(300) << std::endl;


}